<template>
  <basic-container>
    <el-collapse v-model="activeNames">
      <template v-for="(item, index) in list">
        <el-collapse-item :key="index" :title="item.label" :name="index">
          <component
            :key="index"
            ref="page"
            :is="require('@/views/tenant/supplier/info/components/' + item.name).default"
          />
        </el-collapse-item>
      </template>
    </el-collapse>
  </basic-container>
</template>

<script>
import { detailAll } from '@/api/supplier/bak/inforecord'
// import { getDetail } from '@/api/supplier/history'
export default {
  name: 'HistoryView',
  props: ['type', 'params'],
  provide() {
    return {
      infoFlg: false,
      type: this.type,
      slotFlg: true
    }
  },
  data() {
    return {
      list: [
        { label: '基本信息', name: 'history-base' },
        { label: '联系人信息', name: 'contacts-info' },
        { label: '整体人员结构信息', name: 'staff-info' },
        { label: '银行信息', name: 'bank-info' },
        { label: '财务信息', name: 'finance-info' },
        { label: '资质信息', name: 'qualifications-info' },
        { label: '工厂信息', name: 'factory-info' },
        { label: '产品信息', name: 'product-info' },
        { label: '客户/市场信息', name: 'customer-info' },
        { label: '原料信息', name: 'material-info' },
        { label: '设备信息', name: 'equipment-info' },
        { label: '物流信息', name: 'logistics-info' }
      ],
      activeNames: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
    }
  },
  mounted() {
    this.getDetails(this.params.changeId)
  },
  methods: {
    getDetails(id) {
      detailAll({ changeId: id }).then(res => {
        let info = res.data.data
        this.$refs.page[0].info = info
        this.$refs.page[1].contactList = info.contactList
        this.$refs.page[2].staffList = info.staffList
        this.$refs.page[3].bankList = info.bankList
        this.$refs.page[4].financeList = info.financeList
        this.$refs.page[5].data = info.qualificationList
        this.$refs.page[6].factoryList = info.factoryList
        this.$refs.page[7].productList = info.productList
        this.$refs.page[8].customerList = info.customerList
        this.$refs.page[9].materialList = info.materialList
        this.$refs.page[10].equipmentList = info.equipmentList
        this.$refs.page[11].logisticsList = info.logisticsList
      })
    }
  }
}
</script>

<style></style>
